{{- $containerd_version := "1.7.13" }}
{{- $image_version := $containerd_version | replace "." "-" }}
{{- $runc_version := "1.1.12" }}
---
image: {{ $.ModuleName }}/{{ $.ImageName }}-{{ $image_version }}
from: {{ $.Images.BASE_SCRATCH }}
import:
- artifact: {{ $.ModuleName }}/{{ $.ImageName }}-artifact-{{ $image_version }}
  add: /
  to: /
  includePaths:
  - containerd
  - containerd-shim
  - containerd-shim-runc-v1
  - containerd-shim-runc-v2
  - ctr
  - runc
  - install
  - uninstall
  - containerd.service
  before: setup
docker:
  LABEL:
    distro: all
    version: all
    containerd: {{ $containerd_version }}
    runc: {{ $runc_version }}
---
artifact: {{ $.ModuleName }}/{{ $.ImageName }}-artifact-{{ $image_version }}
from: {{ $.Images.BASE_GOLANG_21_BULLSEYE_DEV }}
git:
- add: /{{ $.ModulePath }}modules/007-{{ $.ModuleName }}/images/{{ $.ImageName }}/scripts
  to: /
  stageDependencies:
    install:
      - '**/*'
mount:
- fromPath: ~/go-pkg-cache
  to: /go/pkg
shell:
  install:
  - export GOPROXY={{ $.GOPROXY }}
  - mkdir -p /src
  - cd /src
  - git clone --depth=1 --branch v{{ $containerd_version }} {{ $.SOURCE_REPO }}/containerd/containerd.git
  - cd containerd
  - git config --global user.email "builder@deckhouse.io"
  - make STATIC=1 all
  - mv bin/* /
  - cd /src
  - git clone --depth=1 --branch v{{ $runc_version }} {{ $.SOURCE_REPO }}/opencontainers/runc
  - cd runc
  - git config --global user.email "builder@deckhouse.io"
  - make static
  - mv runc /runc
